package com.huawei.bookborrowms.user.service.impl;

import com.huawei.base.BaseRes;
import com.huawei.bookborrowms.user.dao.UserDao;
import com.huawei.bookborrowms.user.entity.UserEntity;
import com.huawei.bookborrowms.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 黄后林
 * @date 2022-11-11 11:34:57
 * @note 程序员是用代码喂出来的
 */

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao dao;

    @Transactional(readOnly = true)
    @Override
    public BaseRes login(UserEntity user) {
        Integer counter = dao.login(user);
        if(counter ==1){
            return BaseRes.getSuccess(counter);
        }else{
            return BaseRes.getFailure(counter);
        }
    }
}
